"use strict";
/*
* wgeFilterHandler.js
*
*  Created on: 2018-3-12
*      Author: Wang Yang
*        Blog: http://blog.wysaid.org
*        Mail: admin@wysaid.org
*/

WGE.FilterHandler = WGE.Class({

    // filters : undefined,
    context : undefined,
    vertexBuffer : undefined,

    initialize : function (context) {
        this.context = context;
        this.vertexBuffer = WGE.genCommonQuadArrayBuffer(context);
    },

    release : function () {
        if(!this.filters) {
            for(var index in this.filters) {
                this.filters[index].release();
            }
            this.filters = null;
            this.context = null;
        }
    },

    // addFilter : function (filter) {
    //     if(!this.filters) {
    //         this.filters = [];
    //     }
    //
    //     this.filters.push(filter);
    // },

    //直接渲染filter结果到指定的fbo, 不依赖handler
    renderFilter : function (filter, texture, targetFBO) {
        // for(var index in this.filters) {
        //     this.filters[index].render(this, texture, this.vertexBuffer, targetFBO);
        // }

        filter.render(this, texture, this.vertexBuffer, targetFBO);
    },

    //暂不用
    processFilter : function () {

    },

    //暂不用
    render : function () {

    }

});